Virtualization enables a single host machine with hardware and software support for virtualization to present an abstraction of the host, such that the underlying hardware of the host machine appears as one or more independently operating virtual machines. Each virtual machine may therefore function as a self-contained platform. Often, virtualization technology is used to allow multiple guest operating systems and/or other guest software to coexist and execute apparently simultaneously and apparently independently on multiple virtual machines while actually physically executing on the same hardware platform. A virtual machine may mimic the hardware of the host machine or alternatively present a different hardware abstraction altogether.
Virtualization systems may include a virtual machine monitor (VMM) which controls the host machine. The VMM provides guest software operating in a virtual machine with a set of resources (e.g., processors, memory, IO devices). The VMM may map some or all of the components of a physical host machine into the virtual machine, and may create fully virtual components, emulated in software in the VMM, which are included in the virtual machine (e.g., virtual IO devices). The VMM may thus be said to provide a “virtual bare machine” interface to guest software. The VMM uses facilities in a hardware virtualization architecture to provide services to a virtual machine and to provide protection from and between multiple virtual machines executing on the host machine.
As guest software executes in a virtual machine, certain instructions executed by the guest software (e.g., instructions accessing peripheral devices) would normally directly access hardware, were the guest software executing directly on a hardware platform. In a virtualization system supported by a VMM, these instructions may cause a transition to the VMM, referred to herein as a virtual machine exit. The VMM handles these instructions in software in a manner suitable for the host machine hardware and host machine peripheral devices consistent with the virtual machines on which the guest software is executing. Similarly, certain interrupts and exceptions generated in the host machine may need to be intercepted and managed by the VMM or adapted for the guest software by the VMM before being passed on to the guest software for servicing. The VMM then transitions control to the guest software and the virtual machine resumes operation. The transition from the VMM to the guest software is referred to herein as a virtual machine entry.
As is well known, a process executing on a machine on most operating systems may use a virtual address space, which is an abstraction of the underlying physical memory system. As is known in the art, the term virtual when used in the context of memory management e.g. “virtual address,” “virtual address space,” “virtual memory address” or “virtual memory space,” refers to the well known technique of a processor-based system, generally in conjunction with an operating system, presenting an abstraction of underlying physical memory to a process executing on a processor-based system. For example, a process may access a virtual, contiguous and linearized address space abstraction which is mapped to non-linear and non-contiguous physical memory by the underlying operating system. This use of virtual is distinguishable from the use of the same term used in the context virtualization, where virtual generally refers to an abstraction that simulates a physical machine e.g. “virtual machine,” “virtual bare machine,” “virtual hardware,” “virtual processor” or “virtual network interface.” The intended meaning of the term will be clear to one in the art based on the context in which it is used herein.
A processor may be designed in general to allow data from memory to be cached by the processor. Additionally, accesses to data in memory may require one or more actions to be taken with regard to the contents of caching structures in the system processor or processors. These actions are referred to herein as snooping characteristics. Furthermore, certain processors may select to allow dynamic reordering of memory accesses. The type of caching, if any (cacheability) used by the processor to access a location in memory, the snooping characteristics and whether dynamic reordering of memory accesses is enabled for that location determines certain behaviors of the memory location, such as for example whether the memory location supports ordering operations or side-effects of reads correctly. These attributes and others that relate to memory behavior are called a memory type and may be specified for a given memory location and access event using a variety of system flags and registers. Memory types may include, for example, “uncacheable”, “write combining”, “write through”, “write back”, and “write protect”. Memory type range registers, a page attribute table, page tables and other processor control register fields may determine, for each memory access, the relevant memory type for the linear or physical address being accessed. The communication protocols utilized by a processor may vary depending on the memory type of the memory location being accessed.
When a virtual machine executes on a processor supporting different memory types, the virtual machine may also, similarly, support specific memory types for the access of virtual machine physical memory. When the guest accesses memory of a certain memory type in the virtual machine, the correctness of guest execution may depend on the memory access type of the host being consistent with that specified by the guest. Therefore, it is necessary to reconcile memory type specification in the guest with memory type specification in the host in a virtualization system that supports memory type specification.